// pages/order/order.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    bannerSrc: "/images/oder/1.jpg",
    srcArr: [
      "/images/oder/1.jpg",
      "/images/oder/2.jpg",
      "/images/oder/3.jpg",
      "/images/oder/4.jpg",
      "/images/oder/5.jpg",
      "/images/oder/6.jpg",
      "/images/oder/7.jpg",
      "/images/oder/8.jpg",
      "/images/oder/9.jpg"
    ],
    currentIndex:0,
    firstText:'拿铁',
    text:['卡布奇诺','拿铁','焦糖码琪哈朵咖啡','玛莎克兰咖啡','凯旋咖啡','卡鲁娃咖啡','白朗姆火焰','红酒卡布奇诺','蓝山']
  },
  changeSrc:function(e){
    // console.log(e.currentTarget.dataset.index);
    let a = e.currentTarget.dataset.index; //自定义一个变量a
    this.setData({
      currentIndex: a,//a拿到我点击当前的这个图片的索引值传给currentIndex
      bannerSrc: this.data.srcArr[a],//this是代表当前点击的这个图片--然后在传给bannerSrc
      firstText:this.data.text[e.currentTarget.dataset.index]
    }),
    wx.navigateTo({
      url: '/pages/detail/detail',
    })
  },
  goTob(e){
    wx.switchTab({
      url: '/pages/menu/menu',
    })
  },
  goFTob(e) {
    wx.navigateTo({
      url: '/pages/sc/sc',
    })
  }
})